package com.infore.qualityControl.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import com.infore.qualityControl.bo.QualityParamAnalysisBo;
import com.infore.qualityControl.bo.QualityParamSelectBo;
import com.infore.qualityControl.bo.QualityParamSetBo;
import com.infore.qualityControl.constant.ResultConstants;
import com.infore.qualityControl.enums.ResultStatus;
import com.infore.qualityControl.service.IVerificationService;
import com.infore.qualityControl.util.ResultEntity;

@Service
public class VerificationServiceImpl implements IVerificationService {

	@Override
	public ResultEntity verification(QualityParamSelectBo qualityParamSelectBo) {
		if (StringUtils.isBlank(qualityParamSelectBo.getStartTime())
				|| StringUtils.isBlank(qualityParamSelectBo.getEndTime())) {
			return new ResultEntity(ResultStatus.ERROR, ResultConstants.EMPTY_PARAMETER_TIME);
		}
		if (StringUtils.isBlank(qualityParamSelectBo.getStationCodes())) {
			return new ResultEntity(ResultStatus.ERROR, ResultConstants.EMPTY_PARAMETER_STATION);
		}
		if (StringUtils.isBlank(qualityParamSelectBo.getIndexCodes())) {
			return new ResultEntity(ResultStatus.ERROR, ResultConstants.EMPTY_PARAMETER_INDEX);
		}
		return new ResultEntity(ResultStatus.SUCCESS, ResultConstants.VERIFICATION_SUCCESS);
	}
	
	@Override
	public ResultEntity verificationQualitySet(QualityParamSetBo qualityParamSetBo, String type) {
		if (StringUtils.isBlank(qualityParamSetBo.getStationCodes())) {
			return new ResultEntity(ResultStatus.ERROR, ResultConstants.EMPTY_PARAMETER_STATION);
		}
		if (StringUtils.isBlank(qualityParamSetBo.getIndexCode())) {
			return new ResultEntity(ResultStatus.ERROR, ResultConstants.EMPTY_PARAMETER_INDEX);
		}
		switch (type) {
		case "DAY":
			if (qualityParamSetBo.getSpanValue() == null ) {
				
			}
			break;

		default:
			break;
		}
		return null;
	}

	@Override
	public ResultEntity verificationQualityAnalysis(QualityParamAnalysisBo qualityParamAnalysisBo) {
		if (StringUtils.isBlank(qualityParamAnalysisBo.getStartTime())
				|| StringUtils.isBlank(qualityParamAnalysisBo.getEndTime())) {
			return new ResultEntity(ResultStatus.ERROR, ResultConstants.EMPTY_PARAMETER_TIME);
		}
		if (StringUtils.isBlank(qualityParamAnalysisBo.getStationCodes())) {
			return new ResultEntity(ResultStatus.ERROR, ResultConstants.EMPTY_PARAMETER_STATION);
		}
//		if (StringUtils.isBlank(qualityParamAnalysisBo.getQualityAnalysisType())) {
//			return new ResultEntity(ResultStatus.ERROR, ResultConstants.EMPTY_PARAMETER_QUALITY_TYPE);
//		}
		return new ResultEntity(ResultStatus.SUCCESS, ResultConstants.VERIFICATION_SUCCESS);
	}

}
